package com.luojiang.validator.domain;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @ClassName Student
 * @Description
 * @Author luojiang
 * @Date 2020/11/10 19:34
 */
public class Student {

    @NotNull(message = "id不能为空")
    private Long id;
    @NotBlank(message = "姓名不能为空")
    private String name;
    @Valid
    @NotEmpty(message = "请填写爱好")
    @Size(max = 2, message = "爱好不能超过{max}个")
    private List<Hobby> hobbies;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Hobby> getHobbies() {
        return hobbies;
    }

    public void setHobbies(List<Hobby> hobbies) {
        this.hobbies = hobbies;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", hobbies=" + hobbies +
                '}';
    }
}
